package com.example.dzl.service.impl;

import com.example.dzl.VO.DailyActiveUsersVO;
import com.example.dzl.dao.UserActivityMapper;
import com.example.dzl.service.UserActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserActivityServiceImpl implements UserActivityService {

    @Autowired
    private UserActivityMapper userActivityMapper;

    @Override
    public List<DailyActiveUsersVO> getDailyActiveUsers() {
        return userActivityMapper.getDailyActiveUsers();  // 获取日活跃用户数
    }

    // 获取过去 30 天的月活跃用户数
    @Override
    public List<DailyActiveUsersVO> getMonthlyActiveUsers() {
        return userActivityMapper.getActiveUsersByPeriod(30, "weekly");
    }

    // 获取过去 90 天的季度活跃用户数
    @Override
    public List<DailyActiveUsersVO> getQuarterlyActiveUsers() {
        return userActivityMapper.getActiveUsersByPeriod(90, "monthly");
    }

    // 获取过去 180 天的半年活跃用户数
    @Override
    public List<DailyActiveUsersVO> getSemiannualActiveUsers() {
        return userActivityMapper.getActiveUsersByPeriod(180, "monthly");
    }
}

